package com.example.demo.service.impl;

import com.example.demo.mapper.UserMapper;
import com.example.demo.pojo.User;
import com.example.demo.service.UserService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public User getUser(String account, String password) {
        return userMapper.getUser(account,password);
    }

    @Override
    public User getUserByAccount(String account) {
        return userMapper.getUserByAccount(account);
    }

    @Override
    public void insertUser(User user) {
        userMapper.insertUser(user);
    }

    @Override
    public List<User> getAllUser(Integer page, Integer size) {
        PageHelper.startPage(page,size);
        return userMapper.getAllUser(page,size);
    }

    @Override
    public void deleteUser(String uid) {
        userMapper.deleteUser(uid);
    }

    @Override
    public List<User> getAllUser() {
        return userMapper.getAllUser();
    }
}
